﻿// ----------------------------------------------------------------------------------
// Sample Code from Fernando Machado Píriz's blog: http://fernandomachadopiriz.com
//
// <copyright company="Fernando Machado Píriz" file="ProgramToClose.cs">
// Copyright (c) Fernando Machado Píriz. Distributed under FSF's GPL v2.</copyright>
// ----------------------------------------------------------------------------------
// This code and information are provided "as is" without warranty of any kind,
// either expressed of implied, including but not limited to the implied warranties
// of merchantability and/or fitness for a particular purpose.
// ----------------------------------------------------------------------------------
namespace ClosePrograms
{
    /// <summary>
    /// Contains information about a program to be closed during presentations.
    /// </summary>
    public sealed class ProgramToClose
    {
        /// <summary>
        /// Field to store FriendlyName property value.
        /// </summary>
        private string friendlyName;

        /// <summary>
        /// Initializes a new instance of the ProgramToClose class given the full path to program's executable file.
        /// </summary>
        /// <param name="moduleFileName">The full path to program's executable file.</param>
        public ProgramToClose(string moduleFileName)
        {
            this.ModuleFileName = moduleFileName;
            this.friendlyName = ProgramsEnumerator.GetFriendlyName(moduleFileName);
        }

        /// <summary>
        /// Gets program's friendly name. Automatically assigned when <code>ModuleFileName</code> is set.
        /// </summary>
        public string FriendlyName
        {
            get
            {
                return this.friendlyName;
            }
        }

        /// <summary>
        /// Gets or sets the full path to program's executable file.
        /// </summary>
        public string ModuleFileName { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the program was closed when presentation started or not; it will be opened again when
        /// presentation finishes. If the value is null the program was not running when presentation started and should not be opened
        /// again when presentation finishes.
        /// </summary>
        public bool? Closed { get; set; }
    }
}
